<template>
  <div style="height: 100%">
    <UserInfoCard v-if="moduleItemData.homeModuleType === HOME_ITEM_TYPE.USERINFO" :is-pc="moduleItemData.isPc" />
    <TodoCard v-if="moduleItemData.homeModuleType === HOME_ITEM_TYPE.TO_DO" ref="todoCardRef" :style-config="moduleItemData.styleConfig" />
    <QuickEntryCard v-if="moduleItemData.homeModuleType === HOME_ITEM_TYPE.QUICK_ENTRY" ref="quickEntryCardRef" :is-pc="moduleItemData.isPc" :style-config="moduleItemData.styleConfig" />
    <PlatformCard v-if="moduleItemData.homeModuleType === HOME_ITEM_TYPE.PLATFORM" :style-config="moduleItemData.styleConfig" />
  </div>
</template>

<script>
import { HOME_ITEM_TYPE } from '@/utils/const/echarts';
import PlatformCard from './module/PlatformCard';
import QuickEntryCard from './module/QuickEntryCard';
import TodoCard from './module/TodoCard';
import UserInfoCard from './module/UserInfoCard';
export default {
  name: 'HomeItem',
  components: {
    PlatformCard,
    QuickEntryCard,
    TodoCard,
    UserInfoCard
  },
  props: {
    moduleItemData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      HOME_ITEM_TYPE
    };
  },
  methods: {
    resetEchart() {
      if (this.$refs['todoCardRef']) this.$refs['todoCardRef'].resetTable();
      if (this.$refs['quickEntryCardRef']) this.$refs['quickEntryCardRef'].resetTable();
    }
  }
};
</script>

<style lang="scss" scoped>

</style>
